﻿using System.Web.Mvc;

namespace SlamCms.Web.Mvc
{
    public class SlamCmsViewEngine : RazorViewEngine
    {
        public SlamCmsViewEngine()
        {
            base.AreaViewLocationFormats = new[] 
            { 
                "~/Areas/{2}/Views/{1}/DisplayTemplates/{0}.cshtml", 
                "~/Areas/{2}/Views/{1}/{0}.cshtml", 
                "~/Areas/{2}/Views/Shared/DisplayTemplates/{0}.cshtml",
                "~/Areas/{2}/Views/Shared/{0}.cshtml"
            };

            base.AreaMasterLocationFormats = new[] 
            { 
                "~/Areas/{2}/Views/{1}/DisplayTemplates/{0}.cshtml", 
                "~/Areas/{2}/Views/{1}/{0}.cshtml", 
                "~/Areas/{2}/Views/Shared/DisplayTemplates/{0}.cshtml",
                "~/Areas/{2}/Views/Shared/{0}.cshtml"
            };

            base.AreaPartialViewLocationFormats = new[] 
            { 
                "~/Areas/{2}/Views/{1}/DisplayTemplates/{0}.cshtml",
                "~/Areas/{2}/Views/{1}/{0}.cshtml",
                "~/Areas/{2}/Views/Shared/DisplayTemplates/{0}.cshtml",
                "~/Areas/{2}/Views/Shared/{0}.cshtml"
            };

            base.ViewLocationFormats = new[] 
            { 
                "~/Views/{1}/DisplayTemplates/{0}.cshtml", 
                "~/Views/{1}/{0}.cshtml", 
                "~/Views/Shared/DisplayTemplates/{0}.cshtml",
                "~/Views/Shared/{0}.cshtml"
            };

            base.MasterLocationFormats = new[] 
            { 
                "~/Views/{1}/DisplayTemplates/{0}.cshtml",
                "~/Views/{1}/{0}.cshtml",
                "~/Views/Shared/DisplayTemplates/{0}.cshtml",
                "~/Views/Shared/{0}.cshtml"
            };

            base.PartialViewLocationFormats = new[] 
            { 
                "~/Views/{1}/DisplayTemplates/{0}.cshtml",
                "~/Views/{1}/{0}.cshtml",
                "~/Views/Shared/DisplayTemplates/{0}.cshtml",
                "~/Views/Shared/{0}.cshtml"
            };

            base.FileExtensions = new[] { "cshtml" };
        } 
    }
}